home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / L2CDOC.ZIP / LISP2C19.TXT < prev   
Text File  |  1993-06-25  |  36KB  |  830 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. (C) 1993 BASIC d.o.o Ljubljana,
  11. Jure Spiler,
  12. Jesenkova 5,
  13. 61000 Ljubljana, Slovenia
  14. tel: +386 1 314 069
  15. fax: +386 1 318 211
  16. CompuServe: [70541,1765]
  17. e-mail:
  18. Jure Spiler, director    jure.spiler@public1.noprmd.mail.si
  19. Joze Marincek    joze.marincek@uni-lj.si
  20.  
  21.  
  22.  
  23. Lisp2C
  24.                 
  25. AutoLISP to C (ADS) treanslator 
  26. user's guide
  27.  
  28.  
  29.  
  30.  
  31.  
  32. version 1.9 (22-June-1993)
  33.  
  34.  
  35. Table of Contents
  36. Table of Contents    2
  37. 1. INTRODUCTION    3
  38. 2. INSTALLATION    4
  39. 2.1.DOS - WATCOM    4
  40. 2.2.DOS - METAWARE    4
  41. 2.3.WINDOWS - WATCOM    4
  42. 2.4.WINDOWS - METAWARE    5
  43. 2.5. DOS Example (Watcom)    5
  44. 3. THE USAGE    6
  45. 3.1. COMMAND LINE INPUT    6
  46. 3.2. INTERACTIVE INPUT    7
  47. 3.3. PROJECT FILE    8
  48. 3.4. SWITCHES    8
  49. 3.5. COMPILING THE CODE (WATCOM)    9
  50. 3.6. LINKING (WATCOM)    10
  51. 3.7. BINDING (WATCOM)    10
  52. 4. SUPPORTED FUNCTIONS    11
  53. 5. DIFFERENCES AND LIMITATIONS    12
  54. 5.1. EXPRESSIONS OUTSIDE THE FUNCTIONS    12
  55. 5.2 NUMBER OF ARGUMENTS    12
  56. 5.3. PASSING SYMBOLS, SUBROUTINES ETC.    12
  57. 5.4. PASSING LISTS OF INTEGERS ETC.    12
  58. 5.5. BUILD-IN PRIMITIVES    12
  59. 5.6. GLOBAL SYMBOLS    12
  60. 5.7. A SYMBOL TABLE    13
  61. 5.8. NENTSEL, NENTSELP    13
  62. 5.9. ATOMS-FAMILY    13
  63. 5.10. COMMAND    13
  64. 5.12. SPEED    13
  65. 6. FEATURES    14
  66. 6.1. A GARBAGE COLLECTOR    14
  67. 6.2. S::L2CSTARTUP FUNCTION    14
  68. 6.3. AUTOMATIC S::L2CSTARTUP GENERATION    14
  69. 6.4. SCOPING    14
  70. 6.5. MEM FUNCTION    14
  71. 6.6. DEBUGGER    14
  72. 7. A PROGRAMMER'S VIEW    15
  73. 7.1. SymExp    15
  74. 7.2. A FUNCTION CALL MECHANISM    15
  75. 7.3. NAMING CONVENTIONS    16
  76. APPENDIX    17
  77. A. EXAMPLE: DLINE.LSP    17
  78.  
  79.  
  80. 1. INTRODUCTION
  81. Lisp2Cads translates an AutoLISP source file(s) into C source files 
  82. that can be further compiled using the Watcom  or Metaware C 
  83. compiler.
  84. Why would anyone bother to compile the existing .LISP code?
  85. First, this completely protects your algorithms. If you use ordinary 
  86. AutoLISP, you have to provide source that can be read by AutoCAD. 
  87. But then it can also be read by a human. Therefore all of your know-
  88. how is exposed to everyone interested.
  89. Second, an ADS environment is gaining more and more acceptance. 
  90. Lisp2C is a great way to preserve all your investments into Lisp 
  91. (trainig, coding) and slowly moving to the ADS.
  92. And finally, Lisp2C  also includes a debugging tool that is easy to use 
  93. yet powerful.
  94. Requirements are:
  95. *     AutoCAD R12 (Dos, Windows)
  96. *     Watcom C/386 9.0 (9.01d required for Windows), or
  97. * Metaware C/C++ 3.1 and PharLap DOS Extender/Linker
  98. You need DOS4GW.EXE to run L2C.EXE!
  99.  
  100.  
  101. Lisp2Cads consists of:
  102.  
  103. 1.    QSTART.TXT    How to quick - start LISP2C
  104.     LISP2C.DOC    This file (Word for Windows)
  105.     LISP2C.TXT    This file (ASCII)
  106. 2.    L2C.EXE        Lisp to C compiler
  107. 3.    L2C.H        Header file, included into source
  108. 4.    L2C.LIB        Libs:    (Watcom -DOS)
  109.     WINL2C.LIB    (Watcom - Windows)
  110.     MWL2C.LIB    (Metaware - DOS)
  111.     MWWINL2C.LIB    (Metaware - Windows)
  112. 5.    DEMO.LSP    Sample Lisp program 
  113. 6.    DLINE.LSP    Sample LISP from ACAD12
  114. STARTUP.LSP Direct statements from DLINE
  115. DLINE.L2C    Project file to compile DLINE.LSP
  116. Other example files may appear in distribution.
  117.  
  118.  
  119. 2. INSTALLATION
  120. 2.1.DOS - WATCOM
  121. Install your Watcom C/386 9.0 or later compiler and compile at least 
  122. one sample file (eg TOWER.C) from \ACAD\ADS, to ensure that the 
  123. compiler is set up properly.
  124. Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE 
  125. (Watcom DOS extender) into directory pointed by a system variable 
  126. PATH.  We suggest C:\DOS or C:\ACAD directory.
  127. Place L2C.LIB and L2C.H files into \ACAD\ADS directory. Point to 
  128. this directory  with L2C variable:
  129. SET L2C=C:\ACAD\ADS
  130. Change INCLUDE variable to include \ACAD\ADS directory:
  131. SET INCLUDE=C:\WATCOM\H;C:\ACAD\ADS
  132. 2.2.DOS - METAWARE
  133. Install your Metaware HighC/C++ 3.1 compiler and compile at least 
  134. one sample file (eg TOWER.C) from \ACAD\ADS, to ensure that the 
  135. compiler is set up properly.
  136. Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE 
  137. (Watcom DOS extender) into directory pointed by a system variable 
  138. PATH.  We suggest C:\DOS or C:\ACAD directory.
  139. Place MWL2C.LIB and L2C.H files into \ACAD\ADS directory. 
  140. Point to this directory  with L2C variable:
  141. SET L2C=C:\ACAD\ADS
  142. Change IPATH variable to include \ACAD\ADS directory:
  143. SET IPATH=C:\HIGHC\H;C:\ACAD\ADS
  144. Note that paths must be set before Lisp file is converted into C 
  145. source. L2C uses the values of these variables to produce .BAT and 
  146. .MW files. If those values are not set or set properly, .BAT and .MW 
  147. files may not compile the C files. This does not, however, corrupt 
  148. produced C code in any way.
  149. 2.3.WINDOWS - WATCOM
  150. Install your Watcom C/386 9.01d or later compiler and compile at 
  151. least one sample file (eg TOWER.C) from \ACADWIN\ADS, to 
  152. ensure that the compiler is set up properly.
  153. Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE 
  154. (Watcom DOS extender) into directory pointed by a system variable 
  155. PATH.  We suggest C:\DOS or C:\ACADWIN directory.
  156. Place L2CWIN.LIB and L2C.H files into \ACADWIN\ADS 
  157. directory. Point to this directory with L2C variable:
  158. SET L2C=C:\ACADWIN\ADS
  159. Change INCLUDE variable to include \ACADWIN\ADS:
  160. SET INCLUDE=C:\WATCOM\H;C:\ACADWIN\ADS
  161. Copy the file ADS.ICO from ADS\WIN directory to your working 
  162. directory.
  163. 2.4.WINDOWS - METAWARE
  164. Install your Metaware HighC/C++ 3.1 compiler and compile at least 
  165. one sample file (eg TOWER.C) from \ACADWIN\ADS, to ensure 
  166. that the compiler is set up properly.
  167. Tip: Read README.ADS from ACADWin. Use -NOSTUB switch 
  168. with PharLap linker 5.0 or later. Earlier versions of PharLap do not 
  169. need this switch.
  170. Place the files L2C.EXE (Lips2C translator) and DOS4GW.EXE 
  171. (Watcom DOS extender) into directory pointed by a system variable 
  172. PATH. We suggest C:\DOS or C:\ACAD directory.
  173. Place MWL2CWIN.LIB and L2C.H files into \ACADWIN\ADS 
  174. directory. Point to this directory  with L2C variable:
  175. SET L2C=C:\ACADWIN\ADS
  176. Change IPATH variable to include \ACADWIN\ADS directory:
  177. SET IPATH=C:\HIGHC\H;C:\ACADWIN\ADS
  178. Note that paths must be set before Lisp file is converted into C 
  179. source. L2C uses the values of these variables to produce .BAT and 
  180. .MW files. If those values are not set or set properly, .BAT and .MW 
  181. files may not compile the C files. This does not, however, corrupt 
  182. produced C code in any way.
  183. Copy the file ADS.ICO from \ACADWIN\ADS\WIN directory to 
  184. your working directory. Again, this only affects the compilation with 
  185. produced .BAT and other files.
  186. 2.5. DOS Example (Watcom)
  187. Place the rest of the files into your working directory. These files are 
  188. included only as a demonstration and can be deleted altogether.
  189. Example:
  190. Let us assume that you have correctly set up the Watcom C/386 9.0 
  191. to the C:\WATCOM directory. Thus, when you type SET, you might 
  192. see something like 
  193. PATH=...C:\ACAD;C:\WATCOM\BIN;C:\WATCOM\BINB
  194. ;C:\WATCOM\LIB386\DOS;... 
  195. WATCOM=C:\WATCOM\.
  196. INCLUDE=C:\WATCOM\H
  197. In order to use ADS, your C:\ACAD\ADS directory should contain at 
  198. least the following files:
  199.     WCADS90.LIB
  200.     ADSLIB.H
  201.     ADSDLG.H
  202.     ADS.H
  203.     ADSCODES.H
  204. If those files are missing, you can copy them from our distribution.
  205. Now you can copy L2C.EXE to C:\ACAD directory (listed in path), 
  206. and L2C.H, L2C.LIB into C:\ACAD\ADS directory. Also, you should 
  207. change the INCLUDE variable so that Watcom C/386 will search for 
  208. header (.h) files also in C:\ACAD\ADS directory:
  209. SET INCLUDE=C:\WATCOM\H;C:\ACAD\ADS
  210. And finally, you should set the L2C system variable to 
  211. C:\ACAD\ADS:
  212. SET L2C=C:\ACAD\ADS
  213.  
  214.  
  215. 3. THE USAGE
  216. 3.1. COMMAND LINE INPUT
  217. The syntax is:
  218.  L2C [options] file [file...]
  219. where options are
  220. d        includes debugging information
  221. oname    sets the output file name to 'name', instead to the 
  222.         name of 1st input file name
  223. c        compiler (cWAT = Watcom, cMW = Metaware)
  224. e        compiles every function separately
  225. y        "yes" to all questions (except for the registration)
  226. n        "no" to all questions (except for the registration)
  227. t        target (currently Dos or WIndows)
  228. ?        displays simple help
  229. The option must be preceded with either / or - character. If an invalid 
  230. option is specified, program terminates with a message.
  231. File is the name of AutoLISP source file. L2C produces file.C 
  232. file (if more than one file is specified, the first name is taken, unless 
  233. /oname option is used). In ad